using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ECommerce.Library;
using eShop.Business;
using eShop.Utility;

public partial class controls_wucNewsletter : BaseControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        uccResponseMessage.Visible = false;
    }

    protected void btnSubscribe_Click(object sender, EventArgs e)
    {
        if (RegExUtil.IsEmail(tbxNewsletterEmailAddress.Text))
        {
            NewsletterSubscriber subscriber = new NewsletterSubscriber(0, string.Empty, tbxNewsletterEmailAddress.Text, 1);
            subscriber.Update();
            uccResponseMessage.SetSuccessMessage("Successfuly subscribed");
        }
        else
        {
            uccResponseMessage.SetSuccessMessage("Invalid email address entered");
        }
    }
}
